package model.service;

import java.util.List;
import model.dao.InventoryDAO;
import vo.InventoryVO;
import vo.ListVO;
import vo.PagingBean;

public class InventoryService {

private static InventoryService instance=new InventoryService();
	
	private InventoryDAO dao;
	
	private InventoryService(){
		dao=InventoryDAO.getinstance();		
	}
	
	public static InventoryService getInstance(){
		if(instance==null) instance=new InventoryService();
		return instance;
	}
	
	public ListVO selectAllInventory(int pageNo, String id, String searchDate, String searchProduct) throws Exception{
					
		List list=dao.selectAllInventory(pageNo, id, searchDate, searchProduct);
		int totalCount=dao.selectAllCount(id, searchDate, searchProduct);
				
		PagingBean pb=new PagingBean(totalCount, pageNo);
		ListVO lvo=new ListVO(list, pb);
				
		return lvo;
	}
	
	public InventoryVO selectInventoryDetailOfStock(String id, String stockNo)throws Exception {
		
		InventoryVO ivo=dao.selectInventoryDetailOfStock(id, stockNo);
		return ivo;
		
	}
	
	public List selectInventoryDetailOfSale(String id, String stockNo) throws Exception{
		
		List list=dao.selectInventoryDetailOfSale(id, stockNo);		
		return list;
	}
	
	public List selectBestItemList(String id)throws Exception{
		
		List list=dao.selectBestItemList(id);
		return list;
	}
	
}
